﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using EducationManagementSystem.WebSite;

namespace EducationManagementSystem.Student
{
    public partial class ChengJi : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
            }
        }


        private void Bind()
        {
            TextBox1.Text = Session["stuid"].ToString();

            SqlConnection conn = DB.Conn();
            conn.Open();
            string sql = "select b.stuName,c.className,d.courseName,d.courseCount,a.courseScore from Score a,Student b,Class c,Course d where a.stuID='" + Session["stuid"].ToString()+ "' and a.courseID=d.courseID and a.stuID=b.stuID and b.classID=c.classID ";
            SqlCommand cmd = new SqlCommand(sql, conn);
            DataSet ds = new DataSet();
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            sda.Fill(ds);
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            Bind();
        }
    }
}